$(function(){
	
	//初始化
	selCount();
	
	//注销
	$("#qtExit").click(function(){
		$.ajax({
			url: 'user/qtExit',
			type: 'post',
			success:function(res){
				if(res=="success"){
					swal("退出成功!!!"," ","success",{buttons: {}});
					setTimeout('window.location = "good/showIndex"', 2000);
				}else{
					swal("退出失败!!!"," ","warning",{buttons: {}});
				}
			},error:function(){
				swal("退出异常!!!"," ","warning",{buttons: {}});
			}
		});
	});
	
	//查询购物车数量
	function selCount(){
		
		if($('#uid').val()!=''){
		
			var jsonCar = {};
			jsonCar['user.uid'] = $('#uid').val();
			$.ajax({
				type:"post",
				url:"car/selCarCount",
				data:jsonCar,
				success:function(res){
					console.log("查询购物车数量"+res)
					if(res>0){
						$('#zcnum').text(res);
					}
				},error:function(){
					swal("服务器异常!!!"," ","warning",{buttons: {}});
				}
			});
		}
	}
});